home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 8 / The Arsenal Files Collection #8 (Arsenal Computer) (1996).ISO / g_quake / abomb6.zip / ABOMB3.QC < prev    next >
Text File  |  1996-08-12  |  5KB  |  160 lines

  1. // code author status: most of the code by id & rest by me ;)
  2.  
  3. void(entity targ, entity inflictor, entity attacker, float damage) T_Damage;
  4.  
  5. void(entity inflictor, entity attacker, float damage, entity ignore) T_ABombDamage =
  6. {
  7.     local    float     points;
  8.     local    entity    head;
  9.     local    vector    org;
  10.     local    float    mercy;
  11.     local    float    mercy2;
  12.  
  13.     // remove powerups from attacker ...
  14.     //    if (self.super_damage_finished > time)
  15.     //        self.effects = self.effects | EF_DIMLIGHT;
  16.  
  17.     mercy2 = 1;
  18.  
  19. /* old code...
  20.  *
  21.  *    if (attacker.radsuit_finished > time)
  22.  *    {
  23.  *        attacker.items = attacker.items - IT_SUIT;
  24.  *        attacker.radsuit_finished = 0;
  25.  *        attacker.rad_time = 0;
  26.  *        nomercy = nomercy * 0.8;
  27.  *    }
  28.  *
  29.  *    if (attacker.invincible_finished > time)
  30.  *    {
  31.  *        attacker.items = attacker.items - IT_INVULNERABILITY;
  32.  *        attacker.invincible_finished = 0;
  33.  *        attacker.invincible_time = 0;
  34.  *        nomercy = nomercy * 0.8;
  35.  *    }
  36.  *
  37.  *    if (attacker.invisible_finished > time)
  38.  *    {
  39.  *        attacker.items = attacker.items - IT_INVISIBILITY;
  40.  *        attacker.invisible_finished = 0;
  41.  *        attacker.invisible_time = 0;
  42.  *        nomercy = nomercy * 1.05;
  43.  *    }
  44.  *
  45.  * end of old code...
  46.  */
  47.     if (attacker.super_damage_finished > time)
  48.     {
  49.         attacker.items = attacker.items - IT_QUAD;
  50.         attacker.super_damage_finished = 0;
  51.         attacker.super_time = 0;
  52.         mercy2 = mercy2 * 0.85;
  53.     }    
  54.  
  55. // nasty thing here... (nuclear glow... how to make it bright blue?)
  56.     if (deathmatch || coop) attacker.effects = EF_BRIGHTLIGHT;
  57.  
  58.     head = findradius(inflictor.origin, damage+40);
  59.  
  60.     while (head)
  61.     {
  62.         if (head != ignore)
  63.         {
  64.             if (head.takedamage)
  65.             {
  66. /*                org = head.origin + (head.mins + head.maxs)*0.5;
  67.  *                points = 0.5*vlen (inflictor.origin - org);
  68.  *                if (points < 0)
  69.  *                    points = 0;
  70.  *                points = damage - points;
  71.  */
  72.                 points = damage;
  73.                 if (head == attacker)    // this means computer enemies can use it without dying ;)
  74.                     points = attacker.health - 1;
  75.             //        points = points * 0.5;
  76.                 if (points > 0)
  77.                 {
  78.             //        if (CanDamage (head, inflictor)) // fusion-neutron bombs don't care about the walls...
  79.             //        {    // don't kill oldone (might crash)
  80.                         if (head.classname == "monster_oldone")
  81.                             T_Damage (head, inflictor, attacker, 1);
  82.                         else if (head.classname == "player")
  83.                         {
  84.                             if (head.armorvalue > 0) head.armorvalue = 1; // paranoid > 0
  85.                         
  86.                             mercy = mercy2;
  87.                             if (head == attacker) mercy = mercy * mercy; //quad damage
  88.                             if (head.radsuit_finished > time)
  89.                             {
  90.                                 head.items = head.items - IT_SUIT;
  91.                                 head.radsuit_finished = 0;
  92.                                 head.rad_time = 0;
  93.                                 mercy = mercy * 1.2;
  94.                             }
  95.                             if (head.invincible_finished > time)
  96.                             {
  97.                                 head.items = head.items - IT_INVULNERABILITY;
  98.                                 head.invincible_finished = 0;
  99.                                 head.invincible_time = 0;
  100.                                 mercy = mercy * 1.2;
  101.                             }
  102.                             if (head.invisible_finished > time)
  103.                             {
  104.                                 head.items = head.items - IT_INVISIBILITY;
  105.                                 head.invisible_finished = 0;
  106.                                 head.invisible_time = 0;
  107.                                 mercy = mercy * 0.85;
  108.                             }
  109.                             if (head.super_damage_finished > time)
  110.                             {
  111.                                 head.items = head.items - IT_QUAD;
  112.                                 head.super_damage_finished = 0;
  113.                                 head.super_time = 0;
  114.                                 mercy = mercy * 0.8;
  115.                             }
  116.                             
  117.                             // maximum mercy: 1.44 ... minimum: 0.578 ...
  118.                             
  119.                             if ((points < (head.health - head.armorvalue)) && (mercy < 1))
  120.                             {
  121.                                 points = points + 25; //    means that attacker dies if ((IT_QUAD || IT_INVIS) && (!IT_ARMOR && !IT_RADSUIT && !IT_PENTAGRAM))
  122.                             }
  123.                             else
  124.                             {    // paranoid coding, isn't this? ... no >=s ... what are exact values?
  125.                                 if ((points > (head.health + head.armorvalue)) && (mercy >1)) points = head.health + 75 - (50 * random()) - (50 * random());
  126.                             }
  127.                             
  128.                             T_Damage (head, inflictor, attacker, points);
  129. /* experimental code... */
  130.                             stuffcmd (head, "gamma 0.01\n");
  131.                             stuffcmd (head, "wait\n");
  132.                             stuffcmd (head, "gamma 0.03\n");
  133.                             stuffcmd (head, "wait\n");
  134.                             stuffcmd (head, "gamma 0.05\n");
  135.                             stuffcmd (head, "wait\n");
  136.                             stuffcmd (head, "gamma 0.1\n");
  137.                             stuffcmd (head, "wait\n");
  138.                             stuffcmd (head, "gamma 0.2\n");
  139.                             stuffcmd (head, "wait\n");
  140.                             stuffcmd (head, "gamma 0.3\n");
  141.                             stuffcmd (head, "wait\n");
  142.                             stuffcmd (head, "gamma 0.4\n");
  143.                             stuffcmd (head, "wait\n");
  144.                             stuffcmd (head, "gamma 0.5\n");
  145.                             stuffcmd (head, "wait\n");
  146.                             stuffcmd (head, "gamma 0.6\n");
  147.                             stuffcmd (head, "wait\n");
  148.                             stuffcmd (head, "gamma 0.7\n");
  149. /* end of experimental code */
  150.                         }
  151.                         else
  152.                             T_Damage (head, inflictor, attacker, points);
  153. //                    }
  154.                 }
  155.             }
  156.         }
  157.         head = head.chain;
  158.     }
  159. };
  160.